<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑</title>

</head>
<body>
<link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
<script type="text/javascript" th:src="@{/static/js/jquery-3.js}"></script>
<script th:src="@{/static/layui/layui.js}" charset="utf-8"></script>

<link rel="stylesheet" type="text/css" th:href="@{/static/kindeditor/themes/default/default.css}"/>
<script charset="utf-8" th:src="@{/static/kindeditor/kindeditor-all.js}"></script>
<script charset="utf-8" th:src="@{/static/kindeditor/lang/zh_CN.js}"></script>

<style type="text/css">
    .layui-form-selectup dl{
        top:42px;
        bottom:unset;
    }
</style>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>提问审核</legend>
</fieldset>


<div class="layui-form-item">
    <label class="layui-form-label">问题<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${questionAuditPO.issue}" type="text" name='issue' id="issue" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">问题背景&nbsp;:</label>
    <div class="layui-input-block">
        <textarea id="editor_id" name="content" placeholder="我有更好的回答" style="width: 800px;">[[${questionAuditPO.content}]]</textarea>
    </div>
</div>

<script type="text/javascript">
    var basePath = "/";
    KindEditor.ready(function(K) {
        window.editor = K.create('#editor_id', {
            width : '100%',
            height : '350px',
            allowFileManager : true,
            themeType : 'simple',
            readonlyMode : true,
            afterUpload: function(url) {
                $("#inputId").val(url);
            },
            items:[
                'undo', 'redo', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', '|',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor',
                'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat',
                '|', 'table',  'link', 'unlink','image'
            ],
        });
    });
</script>

<div class="layui-form-item">
    <label class="layui-form-label">用户名称<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${userPO.nick}" type="text" name='nick' id="nick" lay-verify="required" readonly="readonly" autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">状态<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <select name="state" id="state" lay-verify="required" style="width:500px; height: 38px;" class="layui-form-selectup">
            <option th:selected="${questionAuditPO.state == 0}" value="0">下架</option>
            <option th:selected="${questionAuditPO.state == 1}" value="1">未通过</option>
            <option th:selected="${questionAuditPO.state == 2}" value="2">通过</option>
            <option th:selected="${questionAuditPO.state == 3}" value="3">未审核</option>
        </select>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">审核说明<span style="color: red">*</span>&nbsp;:</label>
    <div class="layui-input-block">
        <input th:value="${questionAuditPO.account}" type="text" name='account' id="account" lay-verify="required"  autocomplete="off"  style="width:500px;"   class="layui-input" />
    </div>
</div>



<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="editBtn">提交</button>
    </div>
</div>


<script>
    var basePath="/";

    layui.use(['form'],function () {
        var form = layui.form;
        var parentLayer = parent.layer;
        form.on("submit(editBtn)",function () {
            var obj = {
                id:[[${questionAuditPO.id}]],
                state:$("#state").val(),//状态
                account:$("#account").val()
            };
            $.post(basePath+"questionAudit-audit",obj,function (data) {
                if(data.data){
                    parentLayer.msg("修改成功",{
                        icon: 1,
                        time: 10000
                    });
                }else{
                    parentLayer.msg("修改失败",{
                        icon: 1,
                        time: 2000
                    });
                }
                parent.location.reload();
            },"json");

        })
    })
</script>


</body>
</html>